package cn.cdeden.knowledge.domain;

import cn.cdeden.knowledge.domain.dto.TeamDto;
import cn.cdeden.knowledge.domain.vo.TeamLatelyUseVo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* @author Chen
* @date 2022-09-05
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AutoMappers({@AutoMapper(target = TeamDto.class),@AutoMapper(target = TeamLatelyUseVo.class)})
@TableName("team")
public class Team implements Serializable {
    private static final long serialVersionUID = 1L;

//    @ApiModelProperty(value = "编号")
    @TableId(type= IdType.AUTO)
    private Integer id;

//    @ApiModelProperty(value = "团队名称")
    private String teamName;

//    @ApiModelProperty(value = "说明")
    private String instructions;

//    @ApiModelProperty(value = "添加团队成员的默认角色")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String defaultRole;

//    @ApiModelProperty(value = "团队类型")
    private String type;

////    @ApiModelProperty(value = "头像")
//    private String portrait;

//    @ApiModelProperty(value = "头节点Id")
    private String headNodeId;

//    @ApiModelProperty(value = "Minio桶名称")
    private String minioBucket;

//    @ApiModelProperty(value = "团队所有者id")
    private String owner;

//    @ApiModelProperty(value = "空间大小")
    private Long space;

//    @ApiModelProperty(value = "已用空间")
    private Long usedSpace;

//    @ApiModelProperty(value = "创建编号")
    @TableField(fill= FieldFill.INSERT)
    private String createId;

//    @ApiModelProperty(value = "创建者")
    @TableField(fill= FieldFill.INSERT)
    private String createBy;

//    @ApiModelProperty(value = "创建日期")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

//    @ApiModelProperty(value = "更新编号")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateId;

//    @ApiModelProperty(value = "更新者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateBy;

//    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

//    @ApiModelProperty(value = "删除编号")
    private String deleteId;

//    @ApiModelProperty(value = "删除者")
    private String deleteBy;

//    @ApiModelProperty(value = "删除时间")
    private Date deleteTime;

    public void copyFrom(Team source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
